package com.workflow.workflowproject.listener;

import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngines;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * 流程报错监听
 */
@Slf4j
@Component
public class ErrorFlowListener implements FlowableEventListener {
    @Autowired
    private ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

    private static ErrorFlowListener errorFlowListener;

    @PostConstruct
    public void init(){
        errorFlowListener = this;
        errorFlowListener.processEngine = this.processEngine;
    }

    @Override
    public void onEvent(FlowableEvent event) {

    }

    @Override
    public boolean isFailOnException() {
        return false;
    }

    @Override
    public boolean isFireOnTransactionLifecycleEvent() {
        return false;
    }

    @Override
    public String getOnTransaction() {
        return "";
    }
}
